home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Bubka 15
/
Bubka 15.iso
/
utility
/
win
/
msch126i.lzh
/
Src
/
ClsFile.cls
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS (detected)
UTF-8
Wrap
Visual Basic class definition
|
2001-11-13
|
43.2 KB
|
1,189 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "ClsFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
'é╗é╠æ╝ÆΦÉö
Const MAX_PATH = 260
Const OFS_MAXPATHNAME = 128
Const GENERIC_ALL = &H10000000
Const GENERIC_EXECUTE = &H20000000
Const GENERIC_READ = &H80000000
Const GENERIC_WRITE = &H40000000
Const OPEN_ALWAYS = 4
Const OPEN_EXISTING = 3
Const FILE_SHARE_READ = &H1
Const FILE_SHARE_WRITE = &H2
Const FILE_ATTRIBUTE_NORMAL = &H80
Const FILE_BEGIN = 0
Const FILE_CURRENT = 1
Const FILE_END = 2
'é╗é╠æ╝ì\æóæ╠
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
'é╗é╠æ╝API
Private Declare Function GetFileVersionInfo Lib "Version.dll" Alias _
"GetFileVersionInfoA" _
(ByVal lptstrFilename As String, _
ByVal dwHandle As Long, _
ByVal dwLen As Long, _
lpData As Any) As Long
Private Declare Function GetFileVersionInfoSize Lib "Version.dll" Alias _
"GetFileVersionInfoSizeA" _
(ByVal lptstrFilename As String, _
lpdwHandle As Long) As Long
Private Declare Function VerQueryValue Lib "Version.dll" Alias _
"VerQueryValueA" _
(pBlock As Any, _
ByVal lpSubBlock As String, _
lplpBuffer As Any, _
puLen As Long) As Long
Private Declare Sub MoveMemory Lib "kernel32" Alias _
"RtlMoveMemory" _
(Destination As Any, _
ByVal Source As Long, _
ByVal Length As Long)
Private Declare Function FindFirstFile Lib "kernel32" Alias _
"FindFirstFileA" _
(ByVal lpFileName As String, _
lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindClose Lib "kernel32" _
(ByVal hFindFile As Long) As Long
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
ByVal lpSecurityAttributes As Long, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function SetFilePointer Lib "kernel32" _
(ByVal hFile As Long, _
ByVal lDistanceToMove As Long, _
ByVal lpDistanceToMoveHigh As Long, _
ByVal dwMoveMethod As Long) As Long
Private Declare Function ReadFile Lib "kernel32" _
(ByVal hFile As Long, _
lpBuffer As Any, _
ByVal nNumberOfBytesToRead As Long, _
lpNumberOfBytesRead As Long, _
ByVal lpOverlapped As Long) As Long
Private Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" _
(ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Long) As Long
Private Declare Function SearchPath Lib "kernel32" Alias _
"SearchPathA" _
(ByVal lpPath As String, _
ByVal lpFileName As String, _
ByVal lpExtension As String, _
ByVal nBufferLength As Long, _
ByVal lpBuffer As String, _
ByVal lpFilePart As String) As Long
'âAü[âJâCâoDLLé╠ÆΦÉö
Const OF_EXIST = &H4000
Const OF_READ = &H0
Const OF_CREATE = &H1000
'âAü[âJâCâoDLLé╠ì\æóæ╠
Private Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type
'âAü[âJâCâoDLLé╠API
Private Declare Sub LZClose Lib "lz32.dll" (ByVal hfFile As Long)
Private Declare Function LZCopy Lib "lz32.dll" (ByVal hfSource As Long, ByVal hfDest As Long) As Long
'Private Declare Sub LZDone Lib "lz32" ()
Private Declare Function LZInit Lib "lz32.dll" (ByVal hfSrc As Long) As Long
Private Declare Function LZOpenFile Lib "lz32.dll" Alias "LZOpenFileA" (ByVal lpszFile As String, lpOf As OFSTRUCT, ByVal Style As Long) As Long
Private Declare Function LZRead Lib "lz32.dll" (ByVal hfFile As Long, ByVal lpvBuf As String, ByVal cbread As Long) As Long
Private Declare Function LZSeek Lib "lz32.dll" (ByVal hfFile As Long, ByVal lOffset As Long, ByVal nOrigin As Long) As Long
Private Declare Function LZStart Lib "lz32" () As Long
Private Declare Function GetExpandedName Lib "lz32.dll" Alias "GetExpandedNameA" (ByVal lpszSource As String, ByVal lpszBuffer As String) As Long
Private Declare Function BgaCheckArchive Lib "Bga32" (ByVal pszArchive As String, ByVal iMode As Long) As Long
Private Declare Function CabCheckArchive Lib "Cab32" (ByVal pszArchive As String, ByVal iMode As Long) As Long
Private Declare Function TarCheckArchive Lib "Tar32" (ByVal szArcFile As String, ByVal iMode As Integer) As Long
Private Declare Function TarGetArchiveType Lib "Tar32" (ByVal szFileName As String) As Long
Private Declare Function UnlhaCheckArchive Lib "unlha32" (ByVal szFileName As String, ByVal iMode As Long) As Long
Private Declare Function UnZipCheckArchive Lib "unzip32" (ByVal szFileName As String, ByVal iMode As Long) As Long
Private Declare Function Yz1CheckArchive Lib "Yz1" (ByVal strFileName As String, ByVal iMode As Long) As Long
Private Declare Function UnarjCheckArchive Lib "UnArj32j" (ByVal szFileName As String, ByVal iMode As Long) As Long
Private Declare Function UnGCACheckArchive Lib "UnGCA32.dll" (ByVal szFileName As String, ByVal iMode As Long) As Long
Private Declare Function IshFileList Lib "ish32" (ByVal lpszFileName As String, ByVal lpszOutput As String, ByVal wSize As Integer) As Long
Private Declare Function TarGetVersion Lib "Tar32" () As Integer
Private Declare Function Tar Lib "Tar32" _
(ByVal hWnd As Long, _
ByVal szCmdLine As String, _
ByVal szOutput As String, _
ByVal dwSize As Long) As Long
Private Declare Function BgaGetFileCount Lib "Bga32" _
(ByVal pszArchive As String) As Integer
Private Declare Function CabGetFileCount Lib "Cab32" _
(ByVal pszArchive As String) As Long
Private Declare Function TarGetFileCount Lib "Tar32" _
(ByVal szArcFile As String) As Long
Private Declare Function UnlhaGetFileCount Lib "unlha32" _
(ByVal szArcFile As String) As Long
Private Declare Function UnZipGetFileCount Lib "unzip32" _
(ByVal szArcFile As String) As Long
Private Declare Function Yz1GetFileCount Lib "Yz1" _
(ByVal strFileName As String) As Long
Private Declare Function UnarjGetFileCount Lib "UnArj32j" _
(ByVal szArcFile As String) As Long
Private Declare Function UnGCAGetFileCount Lib "UnGCA32" _
(ByVal szArcFile As String) As Long
'èOìæÉ╗âAü[âJâCâoDLLé╠ÆΦÉö
Const ERAR_END_ARCHIVE = 10 'ì┼îπé╠RARÅæî╔(ò¬èäÅæî╔)?
Const ERAR_NO_MEMORY = 11 'Å\ò¬é╚âüâéâèé≡èmò█é┼é½é╚é⌐é┴é╜üB
Const ERAR_BAD_DATA = 12 'âRâüâôâgù╠êµé¬é╘é┴ë≤éΩé─éóéΘüBé▄é╜é═üAÅæî╔é¬ë≤éΩé─éóéΘüB
Const ERAR_BAD_ARCHIVE = 13 'É│ôûé╚RARÅæî╔é┼é═é╚éóüB
Const ERAR_UNKNOWN_FORMAT = 14 'Unrar.DLLé┼é═ê╡éªé╚éóRARâtâHü[â}âbâg
Const ERAR_EOPEN = 15 'Åæî╔é≡èJé¡é▒é╞é¬é┼é½é╚éó
Const ERAR_ECREATE = 16 'âtâ@âCâïé≡ì∞éΘé▒é╞é¬é┼é½é╚éóüB
Const ERAR_ECLOSE = 17 'Åæî╔é≡ò┬é╢éΘì█âGâëü[é¬ö¡É╢üB
Const ERAR_EREAD = 18 'ô╟é▌ĵéΦâGâëü[
Const ERAR_EWRITE = 19 'Åæé½ì₧é▌âGâëü[
Const ERAR_SMALL_BUF = 20 'âRâüâôâgâoâbâtâ@é¬Å¼é│é⌐é┴é╜üB
Const ERAR_BAD_PASSWORD = 21 'âpâXâÅü[âhé¬è╘êßé┴é─éóéΘ(Unrar Moduleô╞Ä⌐é╠ÆΦÉö)
Const RAR_OM_LIST = 0
Const RAR_OM_EXTRACT = 1
Const RAR_SKIP = 0
Const RAR_TEST = 1
Const RAR_EXTRACT = 2
Const RAR_FILE_PASS = &H4
Const ACEERR_MEM = 1 'Å\ò¬é╔âüâéâèé≡èmò█é┼é½é▄é╣é±üB
Const ACEERR_FILES = 2 '
Const ACEERR_FOUND = 3 'âtâ@âCâïé¬î⌐é┬é⌐éΦé▄é╣é±üB
Const ACEERR_FULL = 4 'ë≡ôÇɵé╔Å\ò¬é╚ï≤é½ùeù╩é¬éáéΦé▄é╣é±üB
Const ACEERR_OPEN = 5 'âtâ@âCâïé≡èJé¡é▒é╞é¬é┼é½é▄é╣é±üB
Const ACEERR_READ = 6 'âtâ@âCâïé≡ô╟é▌ĵéΘé▒é╞é¬é┼é½é▄é╣é±üB
Const ACEERR_WRITE = 7 'âfâBâXâNé╔Åæé½ì₧é▐é▒é╞é¬é┼é½é▄é╣é±üB
Const ACEERR_CLINE = 8 '
Const ACEERR_CRC = 9 'Åæî╔é¬ë≤éΩé─éóéΘë┬ö\ɽé¬éáéΦé▄é╖üB
Const ACEERR_OTHER = 10 '
Const ACEERR_EXISTS = 11 'âtâ@âCâïé¬é╖é┼é╔æ╢ì▌é╡é─éóé▄é╖üB
Const ACEERR_END = 128 'ACEÅæî╔é╠âwâbâ_Åεò±é¬î⌐é┬é⌐éΦé▄é╣é±üB
Const ACEERR_HANDLE = 129 'û│î°é╚ânâôâhâïé¬ò╘é┴é─é½é▄é╡é╜
Const ACEERR_CONSTANT = 130 'ÆΦÉöé╠É▌ÆΦé¬è╘êßé┴é─éóé▄é╖üB
Const ACEERR_NOPASSW = 131 'âpâXâÅü[âhé¬É▌ÆΦé│éΩé─éóé▄é╖üB
Const ACEERR_METHOD = 132 'UnAce.DLLé¬âTâ|ü[âgé╡é─éóé╚éóê│Åkò√Ä«é┼é╖üB
Const ACEERR_USER = 255 '
Const ACEOPEN_LIST = 0 'âèâXâgé╠Åoù═(âtâ@âCâïû╝é╠é▌)
Const ACEOPEN_EXTRACT = 1 'ë≡ôÇé▄é╜é═Åæî╔é╠É│ôûɽé╠îƒì╕
Const ACECMD_SKIP = 0 'Åêù¥é╡é╚éóüH(CRCé╠â`âFâbâNé═é╡é╚éó)
Const ACECMD_TEST = 1 'CRCé≡ùÿùpé╡é╜É│ôûɽîƒì╕é╠ì█ÄgùpüB
Const ACECMD_EXTRACT = 2 'Åæî╔é╠ë≡ôÇ
'èOìæÉ╗âAü[âJâCâoDLLé╠ì\æóæ╠
Private Type RarHeaderData
ArcName As String * MAX_PATH 'ë≡ôÇé╡é─éóéΘâtâ@âCâï(âtâïâpâXé¬ò╘é┴é─é¡éΘüB)
FileName As String * MAX_PATH 'ë≡ôÇé╖éΘRARÅæî╔é╔èiö[é│éΩé╜âtâ@âCâïüB
Flags As Long 'ùlüXé╚âtâëâO
PackSize As Long 'ê│ÅkâTâCâY
UnpSize As Long 'ë≡ôÇâTâCâY
HostOS As Long 'ì∞ɼOS
FileCRC As Long '32BitCRC
lngFILETIME As Long 'MS-DOSé╠ô·òt
UnpVer As Long 'ë≡ôÇé┼é½éΘRARé╠âoü[âWâçâô
Method As Long 'ê│Åkò√û@
lngFileAttr As Long 'âtâ@âCâïé╠æ«É½
CmtBuf As String
CmtBufSize As Long
CmtSize As Long
CmtState As Long
End Type
Private Type RAROpenArchiveData
ArcName As String
OpenMode As Long
OpenResult As Long
CmtBuf As String
CmtBufSize As Long
CmtSize As Long
CmtState As Long
End Type
Private Type ACEHeaderData
ArcName As String * MAX_PATH
FileName As String * MAX_PATH 'Åæî╔ôαé╠âtâ@âCâïû╝
Flags As Long 'Åæî╔é╠Åεò±(ârâbâgâIâAÉ┌æ▒)
PackSize As Long 'Åæî╔ôαé╠âtâ@âCâïé╠ê│ÅkâTâCâY
UnpSize As Long 'Åæî╔ôαé╠âtâ@âCâïé╠ë≡ôÇâTâCâY
FileCRC As Long 'Åæî╔ôαé╠âtâ@âCâïé╠32BitCRC
lngFILETIME As Long 'ô·òté╞Ä₧è╘
Method As Long 'ê│Åkò√Ä«
QUAL As Long 'ê│Åké╠ôxìçéó
FileAttrbute As Long 'âtâ@âCâïé╠æ«É½
CmtBuf As String '
CmtBufSize As Long '
CmtSize As Long '
CmtState As Long '
End Type
Private Type ACEOpenArchiveData
ArcName As String
OpenMode As Long
OpenResult As Long
Flags As Long
Host As Long
AV As String * 51
CmtBuf As String
CmtBufSize As Long
CmtSize As Long
CmtState As Long
End Type
'èOìæÉ╗âAü[âJâCâoDLLé╠API
Private Declare Function RAROpenArchive Lib "unrar.dll" _
(ArchiveData As RAROpenArchiveData) As Long
Private Declare Function RARCloseArchive Lib "unrar.dll" _
(ByVal hArcData As Long) As Long
Private Declare Function RARReadHeader Lib "unrar.dll" _
(ByVal hArcData As Long, _
HeaderData As RarHeaderData) As Long
Private Declare Function RARProcessFile Lib "unrar.dll" _
(ByVal hArcData As Long, _
ByVal Operation As Long, _
ByVal DestPath As String, _
ByVal DestName As String) As Long
Private Declare Function ACEOpenArchive Lib "UnACE.dll" _
(ACEOpenData As ACEOpenArchiveData) As Long
Private Declare Function ACECloseArchive Lib "UnACE.dll" _
(ByVal HandleToArchive As Long) As Long
Private Declare Function ACEReadHeader Lib "UnACE.dll" _
(ByVal HandleToArchive As Long, _
ACEHeaderRead As ACEHeaderData) As Long
Private Declare Function ACEProcessFile Lib "UnACE.dll" _
(ByVal HandleToArchive As Long, _
ByVal Operation As Long, _
ByVal DestPath As String) As Long
Private Declare Function ACESetPassword Lib "UnACE.dll" _
(ByVal HandleToArchive As Long, _
ByVal Password As String) As Long
Private mstrFileName As String
Private mTargethWnd As Long
Private mstrOutPut As String
Private mComment As String
Private mCopyRight As String
Public Function GetArcSearch(Optional ByVal lngBufferSize As Long = 131072) As Long
'âtâ@âCâïâTü[â`âvâìâOâëâÇâvâìâVü[âWââé┼é╖üBÆ╖éó(^^;
'ëⁿé┤鱿╬ì⌠é═éáéΦé▄é╣é±(^^;;
'ò╩û╝Meltschmelzené╠ÉSæƒ
'ò╘éΦÆl
'1 - LHA , 2 - ZIP , 3 - CAB , 4 - RAR , 5 - BZA,GZA , 6 - YZ1 , 7 - ACE , 8 - ARJ
'9 - ISH , 10 - UnGCA , 11 - TAR , 12 - MS-COMPRESS , 200 - âAâNâZâXï╓Ä~ , 201 - âTâCâY0
'0 - ë╜é┼éαû│éóâtâ@âCâï , 20 - FCD , 21 - UPX , 22 - FCD(UDF) , 23 - FCD(COMPRESS)
'24 - FCD(RAW) , 25 - FCD(RAW-COMPRESS)
Dim lngResult As Long
Dim lngInstr As Long
Dim Buffer(300) As Byte
Dim SecondBuf() As Byte
Dim lngFileHndle As Long
Dim strResult As String
Dim ReadByte As Long
Dim i As Long
If FileLen(mstrFileName) = 0 Then
GetArcSearch = 201
Exit Function
End If
lngFileHndle = CreateFile(mstrFileName, _
GENERIC_READ, _
FILE_SHARE_READ, _
0, OPEN_EXISTING, _
FILE_ATTRIBUTE_NORMAL, 0)
If lngFileHndle = -1 Then
If IsNotAccessFile = True Then
GetArcSearch = 200
Exit Function
End If
GetArcSearch = 0
End If
lngResult = SetFilePointer(lngFileHndle, 0, 0, FILE_BEGIN)
lngResult = ReadFile(lngFileHndle, Buffer(0), 300, ReadByte, 0)
lngResult = CloseHandle(lngFileHndle)
If Left$(Trim$(StrConv(Buffer(), vbUnicode)), 4) = "SZDD" Then
If LzCheckArchiveEx = True Then
GetArcSearch = 12
Exit Function
End If
End If
If Left$(Trim$(StrConv(Buffer(), vbUnicode)), 2) = "MZ" Then 'Ä⌐î╚ë≡ôÇÅæî╔é╠ÅΩìç
lngFileHndle = CreateFile(mstrFileName, _
GENERIC_READ, _
FILE_SHARE_READ, _
0, OPEN_EXISTING, _
FILE_ATTRIBUTE_NORMAL, 0)
ReDim SecondBuf(lngBufferSize)
lngResult = SetFilePointer(lngFileHndle, 0, 0, FILE_BEGIN)
lngResult = ReadFile(lngFileHndle, SecondBuf(0), lngBufferSize, ReadByte, 0)
lngResult = CloseHandle(lngFileHndle)
If InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "UPX") <> 0 Then
GetArcSearch = 21
Exit Function
End If
If SearchFile("Unlha32.DLL") = True Then
'LZHé┼é═üAò╢ÄÜù±âTü[â`é═èδî»é┼éáéΘüBé╛é¬üAæ╝é╔ò√û@é═é╚éóé╠é┼üB
'éóéΓüAHEADER.TXTé≡î│é╔ì∞ɼé╖éΩé╬éóéóé╛é»é╠é▒é╞é┼é╖é»é╟é╦üB
For i = 0 To 7 '-lh5- éΓ -lh0-é╞éóé┴é╜ò╢ÄÜù±é≡âTü[â`é╡é▄é╖üB
lngInstr = InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "lh" & i)
If lngInstr <> 0 Then 'î⌐é┬é⌐é┴é╜ÅΩìç
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
Next i
lngInstr = InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "lhd")
If lngInstr <> 0 Then 'î⌐é┬é⌐é┴é╜ÅΩìç
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
lngInstr = InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "lzs")
If lngInstr <> 0 Then 'î⌐é┬é⌐é┴é╜ÅΩìç
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
lngInstr = InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "lz4")
If lngInstr <> 0 Then 'î⌐é┬é⌐é┴é╜ÅΩìç
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
lngInstr = InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "lz5")
If lngInstr <> 0 Then 'î⌐é┬é⌐é┴é╜ÅΩìç
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
End If
If SearchFile("UnZip32.DLL") = True Then
If InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "PK") <> 0 Then
If UnZipCheckArchive(mstrFileName, 0) Then
If UnZipGetFileCount(mstrFileName) > 0 Then
GetArcSearch = 2
Exit Function
End If
End If
End If
End If
If SearchFile("Cab32.DLL") = True Then
If InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "MSCF") <> 0 Then
If CabCheckArchive(mstrFileName, 0) Then
GetArcSearch = 3
Exit Function
End If
End If
End If
If SearchFile("Unrar.DLL") = True Then
If InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "Rar!") <> 0 Then
lngResult = UnRarCheckArchiveEx
Select Case lngResult
Case 1, 2
GetArcSearch = 4
Exit Function
End Select
End If
End If
If SearchFile("Bga32.DLL") = True Then
If InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "BZ2") <> 0 Then
If BgaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 5
Exit Function
End If
ElseIf InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "GZIP") <> 0 Then
If BgaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 5
Exit Function
End If
End If
End If
If SearchFile("Yz1.DLL") = True Then
If InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "yz01") <> 0 Then
If Yz1CheckArchive(mstrFileName, 0) Then
GetArcSearch = 6
Exit Function
End If
End If
End If
If SearchFile("Unace.DLL") = True Then
If InStr(Trim$(StrConv(SecondBuf(), vbUnicode)), "*ACE*") <> 0 Then
If UnAceCheckArchiveEx = 0 Then
GetArcSearch = 7
Exit Function
End If
End If
End If
If SearchFile("Tar32.DLL") = True Then
If IsTarBrokenFile = True Then
GetArcSearch = 11
Exit Function
Else
GetArcSearch = 0
End If
End If
GetArcSearch = 0
Else
'Æ╩ÅφÅæî╔é╔æ╬é╖éΘÅêù¥
strResult = Mid$(Trim$(StrConv(Buffer(), vbUnicode)), 1, 15)
If SearchFile("Tar32.DLL") = True Then
If IsTarBrokenFile = True Then
GetArcSearch = 11
Exit Function
Else
GetArcSearch = 0
End If
End If
If SearchFile("Unlha32.DLL") = True Then
For i = 0 To 7
lngInstr = InStr(Trim$(StrConv(Buffer(), vbUnicode)), "lh" & i)
If lngInstr <> 0 Then
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
Next i
lngInstr = InStr(Trim$(StrConv(Buffer(), vbUnicode)), "lhd")
If lngInstr <> 0 Then 'î⌐é┬é⌐é┴é╜ÅΩìç
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
lngInstr = InStr(Trim$(StrConv(Buffer(), vbUnicode)), "lzs")
If lngInstr <> 0 Then 'î⌐é┬é⌐é┴é╜ÅΩìç
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
lngInstr = InStr(Trim$(StrConv(Buffer(), vbUnicode)), "lz4")
If lngInstr <> 0 Then 'î⌐é┬é⌐é┴é╜ÅΩìç
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
lngInstr = InStr(Trim$(StrConv(Buffer(), vbUnicode)), "lz5")
If lngInstr <> 0 Then 'î⌐é┬é⌐é┴é╜ÅΩìç
If UnlhaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 1
Exit Function
End If
End If
End If
If SearchFile("UnZip32.DLL") = True Then
If InStr(strResult, "PK") <> 0 Then
If UnZipCheckArchive(mstrFileName, 0) Then
GetArcSearch = 2
Exit Function
End If
End If
End If
If SearchFile("Cab32.DLL") = True Then
If InStr(strResult, "MSCF") <> 0 Then
If CabCheckArchive(mstrFileName, 0) Then
GetArcSearch = 3
Exit Function
End If
End If
End If
If SearchFile("Unrar.DLL") = True Then
If InStr(strResult, "Rar!") <> 0 Then
lngResult = UnRarCheckArchiveEx
Select Case lngResult
Case 1, 2
GetArcSearch = 4
Exit Function
End Select
End If
End If
If SearchFile("Bga32.DLL") = True Then
If InStr(strResult, "BZ2") <> 0 Then
If BgaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 5
Exit Function
End If
ElseIf InStr(strResult, "GZIP") <> 0 Then
If BgaCheckArchive(mstrFileName, 0) Then
GetArcSearch = 5
Exit Function
End If
End If
End If
If SearchFile("Yz1.DLL") = True Then
If InStr(strResult, "yz01") <> 0 Then
If Yz1CheckArchive(mstrFileName, 0) Then
GetArcSearch = 6
Exit Function
End If
End If
End If
If SearchFile("Unace.DLL") = True Then
If InStr(strResult, "*ACE*") <> 0 Then
If UnAceCheckArchiveEx() = 0 Then
GetArcSearch = 7
Exit Function
End If
End If
End If
If SearchFile("Unarj32j.DLL") = True Then
If Hex$(Buffer(0)) = "60" And Hex$(Buffer(1)) = "EA" Then
If UnarjCheckArchive(mstrFileName, 0) Then
GetArcSearch = 8
Exit Function
End If
End If
End If
If SearchFile("Ish32.DLL") = True Then
If IshCheckArchiveEx = True Then
GetArcSearch = 9
Exit Function
End If
End If
If SearchFile("UnGCA32.DLL") = True Then
If UnGCACheckArchive(mstrFileName, 0) = 1 Then
GetArcSearch = 10
Exit Function
End If
End If
End If
Select Case FCDCheckFile(Buffer())
Case 1
If LCase$(GetFileExtention(mstrFileName)) = "fcd" Then
GetArcSearch = 20
Exit Function
End If
Case 2
If LCase$(GetFileExtention(mstrFileName)) = "fcd" Then
GetArcSearch = 22
Exit Function
End If
Case 3
If LCase$(GetFileExtention(mstrFileName)) = "fcd" Then
GetArcSearch = 23
Exit Function
End If
Case 4
If LCase$(GetFileExtention(mstrFileName)) = "fcd" Then
GetArcSearch = 24
Exit Function
End If
Case 5
If LCase$(GetFileExtention(mstrFileName)) = "fcd" Then
GetArcSearch = 25
Exit Function
End If
End Select
GetArcSearch = 0
End Function
Public Property Let strOutPut(ByVal vData As String)
mstrOutPut = vData
End Property
Public Sub WriteBufferToFile(ByVal Buffer As String, Optional ByVal blnOverWrite As Boolean = True)
On Error GoTo ErrLine
Dim Fnum As Long
Fnum = FreeFile
Open mstrOutPut For Binary Access Write As #Fnum
If blnOverWrite = False Then
If IsFileExist(mstrOutPut) = True Then
If MsgBox("ô»û╝âtâ@âCâïé¬éáéΦé▄é╖üBÅπÅæé½é╡é▄é╖é⌐üH", vbInformation + vbYesNo + vbDefaultButton2) = vbYes Then
Put #Fnum, , Buffer
End If
Else
Put #Fnum, , Buffer
End If
Else
Put #Fnum, , Buffer
End If
Close #Fnum
Exit Sub
ErrLine:
MsgBox Error$(Err.number), vbExclamation
End Sub
Public Sub GetExecuteInfo()
Dim lngDmyHandle As Long
Dim lngFInfoSize As Long
Dim bytDmyVrInfo() As Byte
Dim lngResult As Long
Dim lngPtrVerInfo As Long
Dim lngLgthVerInfo As Long
Dim lngVerInfoTrans As Long
Dim lngLangValue As Long
Dim lngCharValue As Long
Dim strLangSet As String
Dim strComment As String * 128
lngFInfoSize = GetFileVersionInfoSize(mstrFileName, lngDmyHandle)
If lngFInfoSize > 0 Then
ReDim bytDmyVrInfo(lngFInfoSize - 1)
lngResult = GetFileVersionInfo(mstrFileName, _
0, _
lngFInfoSize, _
bytDmyVrInfo(0))
lngResult = VerQueryValue(bytDmyVrInfo(0), _
"\VarFileInfo\Translation", _
lngPtrVerInfo, _
lngLgthVerInfo)
MoveMemory lngVerInfoTrans, _
lngPtrVerInfo, _
lngLgthVerInfo
lngLangValue = lngVerInfoTrans And &HFFFF&
lngCharValue = (lngVerInfoTrans \ 2 ^ 16) And &HFFFF&
strLangSet = Right$("0000" & Hex$(lngLangValue), 4) & _
Right$("0000" & Hex$(lngCharValue), 4)
lngResult = VerQueryValue(bytDmyVrInfo(0), _
"\StringFileInfo\" & strLangSet & "\ProductName", _
lngPtrVerInfo, _
lngLgthVerInfo)
MoveMemory ByVal strComment, _
lngPtrVerInfo, _
lngLgthVerInfo
mComment = Left$(strComment, InStr(strComment, vbNullChar) - 1)
End If
End Sub
Public Property Let TargethWnd(ByVal vData As Long)
mTargethWnd = vData
End Property
Public Property Let strFileName(ByVal vData As String)
mstrFileName = vData
End Property
Public Property Get CopyRight() As String
CopyRight = mCopyRight
End Property
Public Property Get Comment() As String
Select Case Len(mComment)
Case 0
Comment = ""
Case 4
If Asc(Mid$(mComment, 1, 1)) = 17 Then
If Asc(Mid$(mComment, 2, 1)) = 4 Then
If Asc(Mid$(mComment, 3, 1)) = 176 Then
If Asc(Mid$(mComment, 4, 1)) = 4 Then
Comment = ""
Exit Property
End If
End If
End If
End If
Comment = mComment
Case Else
Comment = mComment
End Select
End Property
Private Function FCDCheckFile(Buffer() As Byte) As Long
FCDCheckFile = 0
If Buffer(0) = 1 Then
FCDCheckFile = 3
Exit Function
End If
If Buffer(0) = 5 Then
If Buffer(2) = 6 Then
Select Case Buffer(4)
Case 0
If Buffer(5) = 147 Then
FCDCheckFile = 4
Exit Function
End If
Case 112
If Buffer(5) = 119 Then
FCDCheckFile = 5
Exit Function
End If
End Select
End If
End If
If Buffer(140) = 70 Then
If Buffer(141) = 67 Then
If Buffer(142) = 68 Then
If Buffer(143) = 32 Then
If Buffer(144) = 86 Then
If Buffer(145) = 49 Then
If Buffer(146) = 46 Then
If Buffer(147) = 48 Then
FCDCheckFile = 1
End If
End If
ElseIf Buffer(145) = 52 Then
If Buffer(146) = 46 Then
If Buffer(147) = 48 Then
FCDCheckFile = 2
End If
End If
End If
End If
End If
End If
End If
End If
End Function
Private Function LzCheckArchiveEx() As Boolean
Dim lngLzHndle1 As Long
Dim utdLzStruct As OFSTRUCT
lngLzHndle1 = LZOpenFile(mstrFileName, utdLzStruct, OF_READ)
If lngLzHndle1 = 0 Then
LzCheckArchiveEx = False
Else
LzCheckArchiveEx = True
End If
Call LZClose(lngLzHndle1)
End Function
Private Function IshCheckArchiveEx() As Boolean
Dim lngResult As Long
Dim strBuffer As String
strBuffer = String$(512, vbNullChar)
lngResult = IshFileList(mstrFileName, strBuffer, Len(strBuffer))
If lngResult <> 0 Then
IshCheckArchiveEx = False
Else
IshCheckArchiveEx = True
End If
End Function
Private Function UnRarCheckArchiveEx(Optional ByVal iMode As Long = 0) As Long
Dim lngRarhndle As Long
Dim lngResult As Long
Dim lngDir As Long
Dim lngStatus As Long
Dim intPassFlag As Integer
Dim utdRar As RAROpenArchiveData
Dim utdRarHeader As RarHeaderData
'âtâ@âCâïé¬é╚éóÅΩìçö▓é»éΘüB
If Len(mstrFileName) = 0 Then
UnRarCheckArchiveEx = -1
Exit Function
End If
With utdRar
.ArcName = GetShortPath
.OpenMode = RAR_OM_LIST
.CmtBuf = String$(256, vbNullChar)
.CmtBufSize = 256
End With
lngRarhndle = RAROpenArchive(utdRar)
If lngRarhndle = 0 Then
lngResult = RARCloseArchive(lngRarhndle)
UnRarCheckArchiveEx = utdRar.OpenResult
Exit Function
End If
lngStatus = RARReadHeader(lngRarhndle, utdRarHeader)
Do Until lngStatus <> 0
lngResult = utdRarHeader.Flags And RAR_FILE_PASS
lngDir = utdRarHeader.lngFileAttr And 16
Select Case iMode
Case 0
If lngResult <> 0 Then
intPassFlag = 2
Exit Do
End If
If lngDir = 0 And lngResult = 0 Then Exit Do
lngResult = RARProcessFile(lngRarhndle, RAR_SKIP, "", "")
Case 1, 2
lngResult = RARProcessFile(lngRarhndle, RAR_SKIP, "", "")
Case Else
If lngResult <> 0 Then
intPassFlag = 2
Exit Do
End If
If lngDir = 0 And lngResult = 0 Then Exit Do
lngResult = RARProcessFile(lngRarhndle, RAR_SKIP, "", "")
End Select
If lngResult <> 0 Then
UnRarCheckArchiveEx = lngResult
lngResult = RARCloseArchive(lngRarhndle)
Exit Function
End If
lngStatus = RARReadHeader(lngRarhndle, utdRarHeader)
If lngStatus = ERAR_BAD_DATA Then
UnRarCheckArchiveEx = ERAR_BAD_DATA
Exit Do
End If
Loop
If intPassFlag = 2 Then
'âpâXâÅü[âhÅæî╔é╠ÅΩìç
UnRarCheckArchiveEx = 2
Else
UnRarCheckArchiveEx = 1
End If
lngResult = RARCloseArchive(lngRarhndle)
End Function
Private Function UnAceCheckArchiveEx() As Long
Dim UnAcehndle As Long
Dim UnAceStatus As Long
Dim lngResult As Long
Dim lngDirFlag As Long
Dim utdAce As ACEOpenArchiveData
Dim utdHeader As ACEHeaderData
UnAceCheckArchiveEx = 0
With utdAce
.ArcName = GetShortPath
.OpenMode = ACEOPEN_LIST
End With
UnAcehndle = ACEOpenArchive(utdAce)
If utdAce.OpenResult <> 0 Then
UnAceCheckArchiveEx = utdAce.OpenResult
lngResult = ACECloseArchive(UnAcehndle)
Exit Function
End If
UnAceStatus = ACEReadHeader(UnAcehndle, utdHeader)
If UnAceStatus <> 0 Then
UnAceCheckArchiveEx = UnAceStatus
lngResult = ACECloseArchive(UnAcehndle)
Exit Function
End If
Do Until UnAceStatus <> 0
lngDirFlag = utdHeader.FileAttrbute And 16
lngResult = ACEProcessFile(UnAcehndle, ACECMD_SKIP, CurDir$)
If lngResult = 131 Then
UnAceCheckArchiveEx = lngResult
Exit Do
End If
If lngDirFlag = 0 And lngResult = 0 Then Exit Do
UnAceStatus = ACEReadHeader(UnAcehndle, utdHeader)
Loop
lngResult = ACECloseArchive(UnAcehndle)
End Function
Private Function IsNotAccessFile() As Boolean
Dim intFnum As Integer
Dim strBuffer As String
On Error GoTo errorhndle
intFnum = FreeFile()
strBuffer = String$(256, vbNullChar)
Open mstrFileName For Binary Access Read As #intFnum
Get #intFnum, , strBuffer
Close #intFnum
IsNotAccessFile = False
Exit Function
errorhndle:
IsNotAccessFile = True
End Function
Private Function IsTarBrokenFile() As Boolean
Dim strBuffer As String
Dim lngResult As Long
On Error GoTo errorhndle
strBuffer = String$(512, vbNullChar)
If TarGetVersion <= 56 Then
lngResult = Tar(mTargethWnd, "tnf " & SetQuote(mstrFileName), strBuffer, 512)
Else
lngResult = TarGetArchiveType(mstrFileName)
Select Case lngResult
Case 0, -1
IsTarBrokenFile = False
Case Else
IsTarBrokenFile = True
End Select
Exit Function
End If
Select Case lngResult
Case Is <= 32799
If TarCheckArchive(mstrFileName, 0) <> 0 Then
IsTarBrokenFile = True
Else
IsTarBrokenFile = False
End If
Case Is >= 32800
IsTarBrokenFile = False
End Select
Exit Function
errorhndle:
IsTarBrokenFile = False
End Function
Public Function GetFileExtention(ByVal strString As String) As String
'ègÆúÄqû╝é╠é▌ÆèÅoüB
'Exsample; "C:\List.txt" ü¿ "txt"
Dim i As Long
Dim lngResult As Long
Dim lngResultSecond As Long
If InStr(strString, Chr$(46)) = 0 Then
GetFileExtention = strString
Exit Function
End If
For i = 1 To Len(strString)
lngResult = InStr(i, strString, Chr$(46))
If lngResult <> 0 Then
lngResultSecond = lngResult
End If
Next i
GetFileExtention = Mid$(strString, lngResultSecond + 1, Len(strString) - lngResultSecond)
End Function
Public Function GetFileExtRemove(ByVal strString As String) As String
'âtâïâpâXé⌐éτègÆúÄqé≡Å£éóé╜âpâXé≡ĵô╛
'Exsample; "C:\Windows\System\User32.DLL" ü¿ "C:\Windows\System\User32"
Dim i As Long
Dim lngResult As Long
Dim lngResultSecond As Long
For i = 1 To Len(strString)
lngResult = InStr(i, strString, Chr$(46))
If lngResult <> 0 Then
lngResultSecond = lngResult
End If
Next i
GetFileExtRemove = Mid$(strString, 1, lngResultSecond - 1)
End Function
Private Function GetShortPath() As String
Dim lngResult As Long
Dim strBuffer As String
strBuffer = String$(512, vbNullChar)
lngResult = GetShortPathName(mstrFileName, strBuffer, Len(strBuffer))
If lngResult <> 0 Then
GetShortPath = DelNullChr(strBuffer)
Else
GetShortPath = ""
End If
End Function
Private Function SearchFile(ByVal strFileName As String, Optional strResPath As String) As Boolean
Dim strBuffer As String
Dim lngFilePart As Long
strBuffer = String$(MAX_PATH, vbNullChar)
SearchFile = SearchPath(vbNullString, _
strFileName, _
vbNullString, _
Len(strBuffer), _
strBuffer, _
lngFilePart)
If SearchFile = False Then
strResPath = ""
Else
strResPath = DelNullChr(strBuffer)
End If
End Function
Private Function DelNullChr(ByVal strBuffer As String) As String
If InStr(strBuffer, vbNullChar) > 0 Then
DelNullChr = Left$(strBuffer, InStr(strBuffer, vbNullChar) - 1)
Else
DelNullChr = strBuffer
End If
End Function
Private Function IsFileExist(ByVal strFilePath As String) As Boolean
Dim lngFileHandle As Long
Dim utdWin32Data As WIN32_FIND_DATA
lngFileHandle = FindFirstFile(strFilePath, utdWin32Data)
If lngFileHandle = -1 Then
IsFileExist = False
Else
IsFileExist = True
End If
Call FindClose(lngFileHandle)
End Function
Private Function SetQuote(ByVal strString As String) As String
If InStr(strString, " ") Or InStr(strString, ",") Then
SetQuote = """" & strString & """"
Else
SetQuote = strString
End If
End Function
Private Function UnRarGetFileCountEx() As Long
Dim lngRarhndle As Long
Dim lngStatus As Long
Dim lngResult As Long
Dim intFCount As Long
Dim utdRar As RAROpenArchiveData
Dim utdRarHeader As RarHeaderData
With utdRar
.ArcName = GetShortPath
.OpenMode = RAR_OM_LIST
.CmtBuf = String$(256, vbNullChar)
.CmtBufSize = 256
End With
lngRarhndle = RAROpenArchive(utdRar)
If lngRarhndle = 0 Then
UnRarGetFileCountEx = -1
Exit Function
End If
lngStatus = RARReadHeader(lngRarhndle, utdRarHeader)
Do Until lngStatus <> 0
If (utdRarHeader.lngFileAttr And 16) = 0 Then
intFCount = intFCount + 1
End If
lngResult = RARProcessFile(lngRarhndle, RAR_SKIP, "", "")
If lngResult <> 0 Then
UnRarGetFileCountEx = -1
lngResult = RARCloseArchive(lngRarhndle)
Exit Function
End If
lngStatus = RARReadHeader(lngRarhndle, utdRarHeader)
If lngResult = ERAR_BAD_DATA Then
UnRarGetFileCountEx = -1
lngResult = RARCloseArchive(lngRarhndle)
Exit Function
End If
Loop
lngResult = RARCloseArchive(lngRarhndle)
UnRarGetFileCountEx = intFCount
End Function
Private Function AceGetFileCountEx() As Long
Dim lnghndle As Long
Dim lngStatus As Long
Dim lngResult As Long
Dim intFCount As Long
Dim utdAce As ACEOpenArchiveData
Dim utdHeader As ACEHeaderData
With utdAce
.ArcName = GetShortPath
.OpenMode = ACEOPEN_LIST
End With
lnghndle = ACEOpenArchive(utdAce)
lngStatus = ACEReadHeader(lnghndle, utdHeader)
Do Until lngStatus <> 0
If (utdHeader.FileAttrbute And 16) = 0 Then
intFCount = intFCount + 1
End If
lngResult = ACEProcessFile(lnghndle, ACECMD_SKIP, "")
lngStatus = ACEReadHeader(lnghndle, utdHeader)
Loop
lngResult = ACECloseArchive(lnghndle)
AceGetFileCountEx = intFCount
End Function
Public Function GetCountUnlha() As Long
GetCountUnlha = UnlhaGetFileCount(mstrFileName)
End Function
Public Function GetCountCab() As Long
GetCountCab = CabGetFileCount(mstrFileName)
End Function
Public Function GetCountUnZip() As Long
GetCountUnZip = UnZipGetFileCount(mstrFileName)
End Function
Public Function GetCountUnRar() As Long
GetCountUnRar = UnRarGetFileCountEx
End Function
Public Function GetCountUnAce() As Long
GetCountUnAce = AceGetFileCountEx
End Function
Public Function GetCountBga() As Long
GetCountBga = BgaGetFileCount(mstrFileName)
End Function
Public Function GetCountTar() As Long
GetCountTar = TarGetFileCount(mstrFileName)
End Function
Public Function GetCountYz1() As Long
GetCountYz1 = Yz1GetFileCount(mstrFileName)
End Function
Public Function GetCountUnGCA() As Long
GetCountUnGCA = UnGCAGetFileCount(mstrFileName)
End Function
Public Function GetCountUnArj() As Long
GetCountUnArj = UnarjGetFileCount(mstrFileName)
End Function